home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 128 25
/
q25.d81
/
t.megabasic 1
< prev
next >
Wrap
Text File
|
2022-08-28
|
12KB
|
312 lines
M E G a B a s i c
by e. g. bell
BASIC programmers have a VERY powerful computer in the Commodore 128.
There are a lot of tools to make life for the programmer easier. People who
cut their teeth on the C64 didn't have all the sprite, music, and graphic
commands to take the sweat and pain out of development of their
masterpieces. Of course, this kind of problem has never proven much
resistance for the people who program the C64 and C128. When they need
tools they write them, and there have been a LOT of powerful utilities
developed over the years. You have to wonder how many of the power features
of the C128 came as the direct result of these programs.
Many of the support magazines that rose and fell over the years
published these gems, and as time went on, our toolboxes became quite full.
But there never seem to be enough tools. Even now development continues on
our 8 bit machines. People are wringing more powerful, more wonderful
things from them. There are always tasks that can be made easier, smaller,
faster, or just more fun.
The variety of tools developed, I believe, has been largely because
programmers needed them. Each programmer has a different style, and thus
often different needs, or different perspectives on what it takes to meet
these needs properly. Some utilties have been around for years. Some have
cropped up with new spins on old capabilities. Every once in awhile, you
get some that you haven't seen before. I believe you will find MEGaBasic to
be a nice mix of these. Some new, some old, most with a new twist. I'm
positive you will find this collection of utilities a valuable addition to
your toolbox.
*** MEGaBasic 2.16 Command Set
help change dlist
find merge quit
read resave old
move combine lsave
start compare control
*** Getting Started
MEGaBasic lives in memory at $DC00/57344 in RAM-1 as a 'permanant' home.
To install the utility, there are just 2 simple steps:
bload "megabasic 2.16",b1,u<drive number>
bank 1 : sys 57344 : clr
The CLR command is NECESSARY to make doubly sure that MEGaBasic is safe from
assault by BASIC program variables.
When you issue the BANK 1:SYS 57344 :clr commands, the controlling
portion of MEGaBasic is moved down to address 4864. This is the focal point
of all the available commands. When you request a function, that function
is moved down into a staging area and does its job. This happens every time
you issue a command.
MEGaBasic protects itself from BASIC variables. Thus you don't have to
worry about your BASIC program clobbering MEGaBasic. The code living at
4864 can be disabled by typing the QUIT command. But MEGaBasic is rather
hardy. It is still in memory, and can be reactivated with the 'bank 1:sys
57344 command'. It is so hardy, in fact, it will even survive a trip into
64 mode and back to 128 mode.
*** Conventions
As you read this document, you will be shown syntax for those commands
that must be supplied information in order to work. When you see the
syntax, everything enclosed in <> characters is an optional part of the
command. For any command syntax displayed in [] characters, this indicates
that there are two possible forms of the argument, one or the other may be
used, but not both.
For the most part, the parameters you will see are:
<,u#> This means you can specify the drive which the command or
function affects. Note that the syntax is the same as for the standard
BASIC 7.0 disk commands like DSAVE, BLOAD, COLLECT, etc.
<,from-line> This entry determines where in the program the specified
operation will begin. The 'from-line' is the first line of the program that
will be affected by the FIND, CHANGE, DLIST, MERGE, etc. The default is the
first line of the program or file.
<,to-line> This entry determines where in the program the specified
operation will end. The 'to-line' is the last line of the program that will
be affected by the FIND, CHANGE, DLIST, MERGE, etc. The default is the last
line of the program or file.
*Note* The from-line in any of the commands that use that parameter MUST be
preceded by a comma. However, you can use a '-' between the 'from' and 'to'
line entries instead of a comma if you wish. For example, all of the
following forms are correct:
find @string@,100-500
or find @string@,100,500
change @old@new@,100,500
or change @old@new@,100-500
move,100,500,1000
or move,100-500,1000
or move,100-500-1000
Also note that if you only specify the from-line, you must not enter the
'-' as you would when listing a program, for example. Use of the from-line
only, without a to-line, will accomplish the desired effect of acting on
lines from 'from-line' to the end of the file in memory.
In addition, if you choose to use a <to-line>, you *must* use a <from-
line>.
For all but a few of the MEGaBasic commands, you can get a display of
the syntax by typing just the command without any parameters. For example,
type CHANGE and press RETURN and the syntax for the CHANGE command will be
displayed as a quick reminder of how to use the command. Do the same thing
with FIND, COMPARE, RESAVE, and most all of the commands. The exceptions to
this are OLD, HELP, and QUIT.
MEGaBasic keeps its own record of the current drive for all of its
commands. The first time you install MEGaBasic, it records the last
accessed disk unit if valid. If not, it defaults to 8. After that, that
setting is used for the commands that involve a drive if you don't specify a
drive. Each time you specify a drive using the 'u#' argument, this setting
is updated to that value. Thus, the '<,U#> can frequently be omitted if you
are using the same drive for all operations.
*** HELP
HELP brings up the list of available commands. In 80 column mode, you
will get a 3 column display as above. In 40 column mode the display is a
single column. Although MEGaBasic won't disturb a running BASIC program,
you should disable it before you start your programs. This will assure that
the BASIC 7.0 HELP command is recognized as distinct from the MEGaBasic
HELP command.
*** CHANGE
CHANGE allows you to change strings from one thing to another in your
programs. This is a very handy utility. When you want to change something
throughout your program or in a certain range, this command assures that all
instances are changed.
The syntax for the CHANGE command is:
change /old/new/ <,from-line><,to-line>
change @old@new@ <,from-line><,to-line>
change "old" <to> "new" <,from-line><,to-line>
Note that there are 3 different possible delimiters for the change command.
The '/' and '@' delimiters function identically. This means there are no
characters that can't be found and changed. These delimiters are used
whenever the string you want to change is a BASIC keyword, or includes an
embedded BASIC keyword. For example, if you wanted to change PRINT to
PRINT#3, you would use one of these delimiters.
Ex:
change/print/print#3/
or change@print@print#3@
Note that all delimiters are the same within a command line. You can't mix
them.
The " delimiter is used when you want to change control characters or
uppercase letters or strings. Note that to CHANGE, the following lines are
quite different, and are going to respond differently to attempts to change
'print' to something different.
10 print
20 rem print
30 print "print"
Assume you issue the command
change /print/print#3,/
The program would be changed in the following way:
10 print#3,
20 rem print
30 print#3,"print"
Assume you issue the command
change "print" to "print#3"
Now the program would be changed as follows:
10 print
20 rem print#3
30 print "print#3"
The difference lies in BASIC's tokenization of commands. The BASIC
command 'PRINT' is tokenized to a 1 character token by the BASIC interpreter
built into your machine. However, strings